Skip to content

OPS-11: dependency guard (runtime allowlist, tarball contents) - #99

Merged
securedeveloper merged 1 commit into
mainfrom
ops-11-deps
Nov 16, 2026
Merged

securedeveloper merged 1 commit into
mainfrom
ops-11-deps

Conversation

@securedeveloper

Copy link
Copy Markdown
Owner

OPS-11 (dependency audit) for javascript-excel: a runtime-dependency guard in CI, plus one dev declaration. No removals were needed. This changes CI and dev files only, so no changeset.

Audit result

before after
runtime dependencies / peerDependencies of the published package 0 / 0 (target: zero) 0 / 0, now enforced
tarball 77 files: dist/ + README + LICENSE + package.json same, now enforced
declared dev dependencies (unique / declarations across workspaces) 13 / 27 13 / 28 (examples/node declares the typescript it already used)
lockfile packages 245 245
GitHub dependency graph / open Dependabot alerts 278 / 1 unchanged by this PR (see below)

Verified with npm view javascript-excel@next dependencies, a clean install of the published tarball (npm ls --omit=dev --all shows only the package), and npm pack --dry-run. depcheck 1.4.7 and knip 5 ran via npx (nothing added).

dev dependency why verdict
@changesets/cli (root) versioning and the CHANGELOG (version-packages) keep
tsdown, typescript 7.0.2 build (ESM/CJS/d.ts with isolatedDeclarations), typecheck keep
vitest, vite, happy-dom unit tests, the /dom tests, the playground keep
@vitest/browser-playwright, playwright the Browser job (real Chromium) keep
publint npm run lint keep
@types/node Node types for tests, scripts and examples keep
examples' react, react-dom, vue, @types/react(-dom) the framework examples the Docs job builds keep (private workspaces, not published)
typedoc + typescript 6.0.3 (tools/api-docs) the API reference; typedoc needs the TS 6 compiler API keep
typescript in examples/node its check script runs tsc, which worked only through hoisting declared (same 7.0.2, no new package)

knip also reported examples/snippets → javascript-excel as unused. That's a false positive: the snippets import it, and are only type-checked.

Open Dependabot alert: minimatch (medium, < 11.0.1), reached through typedoc 0.28.20 in tools/api-docs (private, CI-only, never published). The latest typedoc still requires minimatch ^10.2.5. An npm overrides entry forcing 11 didn't re-resolve cleanly, and when forced it broke the docs build, so it isn't in this PR. Recommendation: dismiss the alert as dev-only, or wait for typedoc to move to minimatch 11.

Duplicates in the lockfile (22 names with two versions) are upstream pins: vite 8.3.8 pins rolldown ~1.2.18 and tsdown 0.23.7 pins ~1.3.0 (with their platform bindings). Overriding either would run a tool on a version it doesn't expect.

The guard

  • scripts/check-deps.mjs (built-ins only; shared verbatim with react-data-export, react-data-import and react-xlsx-viewer), with unit tests in scripts/check-deps.test.mjs. It fails when the published package:
    • has a runtime dependencies entry outside --allow
    • has a peerDependencies entry outside --peer
    • has any optionalDependencies or bundleDependencies
    • with --pack: would publish anything other than dist/**, package.json, README.md, LICENSE or CHANGELOG.md, which keeps private workspaces, sources, tests and fixtures out of the tarball
  • CI: a new step, "Dependency guard (runtime allowlist, tarball contents)", in the required Node 22/Node 24 jobs (and Node 26), after the build:
    node scripts/check-deps.mjs --package packages/javascript-excel --allow '' --pack
    Adding a runtime dependency now means changing that allowlist in the same PR, where it gets reviewed.
  • Locally (Node 26.13.1): "check-deps ok: javascript-excel: dependencies [none], peers [none], 77 files in the tarball". With a left-pad dependency added by hand, it exits 1 with "dependencies: "left-pad" is not in the allowlist (none)". The scripts' tests pass (60, including the 7 new ones). examples/node type-checks.

…ript

scripts/check-deps.mjs (shared with the other three repos) fails CI when the
published package gains a runtime or peer dependency outside the allowlist,
any optional or bundled dependency, or a tarball file other than dist/,
package.json, README, LICENSE and CHANGELOG. javascript-excel's allowlist is
empty. examples/node runs tsc, so it now declares the typescript it used
through hoisting (same 7.0.2; the lockfile keeps 245 packages).
@securedeveloper
securedeveloper merged commit 4e22a94 into main Nov 16, 2026
9 checks passed
@securedeveloper
securedeveloper deleted the ops-11-deps branch November 16, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant